import { useState, useEffect } from 'react'
import MarkdownRenderer from './components/MarkdownRenderer'

function App() {
  const [markdownContent, setMarkdownContent] = useState('')

  useEffect(() => {
    // 加载Markdown文件内容
    fetch('/src/example.md?t=' + Date.now().toString())
      .then((response) => response.text())
      .then((text) => setMarkdownContent(text))
      .catch((error) => console.error('加载Markdown文件失败:', error))
  }, [])

  return (
    <>
      <MarkdownRenderer content={markdownContent} />
    </>
  )
}

export default App
